package com.lili.collection.jdbc.config;

import com.lili.collection.core.config.Config;
import com.lili.collection.core.domain.CollectCommonConfig;
import com.lili.collection.jdbc.enums.TransactionIsolationLevel;
import lombok.Data;

import java.util.Properties;

/**
 * @author lili
 * @description TODO
 * @date 2023/2/15 0:13
 */
@Data
public abstract class HikariPoolConfig extends CollectCommonConfig implements Config {
    public static final int MILLISECONDS = 1000;

    public boolean autoCommit = false;
    public boolean readOnly = false;
    public String connectionString;
    public String driverClassName;
    public String username;
    public String password;
    public Integer maximumPoolSize = 1;
    public Integer minIdle = 1;
    public Integer connectionTimeout = 30;
    public Integer idleTimeout = 10 * 60 * MILLISECONDS;
    public Integer maxLifetime = 30 * 60 * MILLISECONDS;
    public TransactionIsolationLevel transactionIsolation = TransactionIsolationLevel.DEFAULT;
    public String connectionTestQuery;
    public String initialQuery;
    private Properties driverProperties = new Properties();
}
